<include file="Public:header" />

<div class="subnav">
<div class="content_menu ib_a blue line_x">
		<a href="/?m=admin&c=article&a=index&menuid=350" class="on"><em>文章列表</em></a><span>|</span> <a href="/?m=admin&c=article&a=add&menuid=350" class=""><em>添加文章</em></a>    </div>
	</div>
	<form id="info_form" action="{:u('article/edit')}" method="post" enctype="multipart/form-data">
		<div class="pad_lr_10">
			<div class="col_tab">
				<ul class="J_tabs tab_but cu_li">
					<li class="current">{:L('article_basic')}</li>
					<li>{:L('article_seo')}</li>
				</ul>
				<div class="J_panes">
					<div class="content_list pad_10">
						<table width="100%" cellspacing="0" class="table_form">
							<tr>
								<th width="120">{:L('article_cateid')} :</th>
								<td><select class="J_cate_select mr10" data-pid="0" data-uri="{:U('articlecate/ajax_getchilds')}" data-selected="{$selected_ids}"></select>
									<input type="hidden" name="cate_id" id="J_cate_id" value="{$info.cate_id}" /></td>
								</tr>
								<tr>
									<th>{:L('article_title')} :</th>
									<td>
										<input type="text" name="title" id="J_title" rel="title_color" class="input-text iColorPicker" size="60" value="{$info.title}" style="color:{$info.colors}">
										<input type="hidden" value="{$info.colors}" name="colors" id="title_color">
										<a href="javascript:;" class="color_picker_btn"><img class="J_color_picker" data-it="J_title" data-ic="J_color" src="__STATIC__/images/color.png"></a>
									</td>
								</tr>

								<tr>
									<th>文章缩略图 :</th>
									<td>
										<input type="text" name="pic" id="J_img" class="input-text fl mr10" size="30" value="{$info.pic|default='__PUBLIC__/static/images/admin/noimg.jpg'}">
										<div id="J_upload_img" class="upload_btn"><span>{:L('upload')}</span></div>
									</td>
								</tr>
								<tr>
									<th>关联产品 :</th>
									<td><input type="text" name="author" class="input-text" size="30" value="{$info.author}"></td>
								</tr>
								<tr>
									<th>详细内容 :</th>
									<td><textarea name="info" id="info" >{$info.info}</textarea></td>
								</tr>
								<tr>
									<th>{:L('publish')} :</th>
									<td>
										<label><input type="radio" name="status" class="radio_style" value="1" <if condition="$info.status eq '1'">checked="checked"</if>> {:L('yes')}</label>&nbsp;&nbsp;
										<label><input type="radio" name="status" class="radio_style" value="0" <if condition="$info.status eq '0'">checked="checked"</if>> {:L('no')}</label>
									</td>
								</tr>
							</table>
						</div>
						<div class="content_list pad_10 hidden">
							<table width="100%" cellspacing="0" class="table_form">
								<tr>
									<th width="120">{:L('seo_title')} :</th>
									<td><input type="text" name="seo_title" id="seo_title" class="input-text" size="60" value="{$info.seo_title}"></td>
								</tr>
								<tr>
									<th>{:L('seo_keys')} :</th>
									<td><input type="text" name="seo_keys" id="seo_keys" class="input-text" size="60" value="{$info.seo_keys}"></td>
								</tr>
								<tr>
									<th>{:L('seo_desc')} :</th>
									<td><textarea name="seo_desc" id="seo_desc" cols="80" rows="8">{$info.seo_desc}</textarea></td>
								</tr>
							</table>
						</div>
					</div>
					<div class="mt10"><input type="submit" value="{:L('submit')}" id="dosubmit" name="dosubmit" class="btn btn_submit" style="margin:0 0 10px 100px;"><br /><br /><br /></div>
				</div>
			</div>
			<input type="hidden" name="menuid"  value="{$menuid}"/>
			<input type="hidden" name="id" id="id" value="{$info.id}" />
		</form>
		<include file="Public:footer" />
		<script src="__STATIC__/js/jquery/plugins/iColorPicker.js"></script>
		<script src="__STATIC__/js/jquery/plugins/colorpicker.js"></script>
<script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/ueditor.all.js"></script>
 <script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
		<script src="__STATIC__/js/fileuploader.js"></script>
		<script>
			$('.J_cate_select').cate_select('请选择');
			$(function() {
 window.UEDITOR_HOME_URL = "__STATIC__/ueditor/";
    $(document).ready(function () {
      UE.getEditor('info', {
      initialFrameHeight: 500,
      initialFrameWidth: 'auto',
      serverUrl: "{:U('Ueupload/upload')}"
    });
  });	
				$('ul.J_tabs').tabs('div.J_panes > div');

	//颜色选择器
	$('.J_color_picker').colorpicker();
	//自动获取标签
	$('#J_gettags').live('click', function() {
		var title = $.trim($('#J_title').val());
		if(title == ''){
			$.yhxia.tip({content:lang.article_title_isempty, icon:'alert'});
			return false;
		}
		$.getJSON('{:U("article/ajax_gettags")}', {title:title}, function(result){
			if(result.status == 1){
				$('#J_tags').val(result.data);
			}else{
				$.yhxia.tip({content:result.msg});
			}
		});
	});

	//上传图片
    var uploader = new qq.FileUploaderBasic({
    	allowedExtensions: ['jpg','gif','jpeg','png','bmp','pdg'],
        button: document.getElementById('J_upload_img'),
        multiple: false,
        action: "{:U('user/ajax_upload_img')}",
        inputName: 'img',
        forceMultipart: true, //用$_FILES
        messages: {
        	typeError: lang.upload_type_error,
        	sizeError: lang.upload_size_error,
        	minSizeError: lang.upload_minsize_error,
        	emptyError: lang.upload_empty_error,
        	noFilesError: lang.upload_nofile_error,
        	onLeave: lang.upload_onLeave
        },
        showMessage: function(message){
        	$.yhxia.tip({content:message, icon:'error'});
        },
        onSubmit: function(id, fileName){
        	$('#J_upload_img').addClass('btn_disabled').find('span').text(lang.uploading);
        },
        onComplete: function(id, fileName, result){
        	$('#J_upload_img').removeClass('btn_disabled').find('span').text(lang.upload);
            if(result.status == '1'){
        		$('#J_img').val(result.data);
        	} else {
        		$.yhxia.tip({content:result.msg, icon:'error'});
        	}
        }
    });
});
</script>
</body>
</html>